-
Notifications
You must be signed in to change notification settings - Fork 13.5k
rustdoc-json: Structured attributes #142936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustdoc-json: Structured attributes #142936
Conversation
r? @notriddle rustbot has assigned @notriddle. Use |
rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing |
Awesome alona! I'll take a proper look tomorrow <3 |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this!
In the near term cargo-semver-checks will have to internally re-stringify the attributes just for code compatibility with prior rustdoc JSON versions. But I look forward to the day when I can rip all that out and enjoy the structured form instead!
☔ The latest upstream changes (presumably #142929) made this pull request unmergeable. Please resolve the merge conflicts. |
rustbot has assigned @GuillaumeGomez. Use |
These commits modify Please ensure that if you've changed the output:
|
1d4b795
to
c912543
Compare
Now no longer WIP. When you're happy with it, let me know but don't r+, as I'll need to squash commits. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Looking forward to this!
src/librustdoc/clean/types.rs
Outdated
// NoMangle is special cased, as it's currently the only structured | ||
// attribute that we want to appear in HTML output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a separate concern unrelated to this PR, perhaps HTML output should list both #[no_mangle]
and #[export_name]
in their edition 2024 form i.e. wrapped in unsafe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please open an issue then so it's not forgotten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already track this in #142835 (comment) (jana is assigned)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me. It's nice to see less is_json
conditions in the common code. :)
☔ The latest upstream changes (presumably #143074) made this pull request unmergeable. Please resolve the merge conflicts. |
c5a697c
to
df1d953
Compare
…istime, r=GuillaumeGomez rustdoc-json: Structured attributes Implements and closes rust-lang#141358. This has 2 primary benefits. 1. For rustdoc-json consumers, they no longer need to parse strings of attributes, but it's there in a structured and normalized way. CC `@obi1kenobi` 2. For rustc conributors, the output of HIR pretty printing is no longer a versioned thing in the output. People can work on rust-lang#131229 without needing to bump `FORMAT_VERSION`. CC `@jdonszelmann` `@JonathanBrouwer.` (Over time, as the attribute refractor continues, I expect we'll add new things to `rustdoc_json_types::Attribute`. But this can be done separately to the rustc changes). Todo before being mergable: - [x] Update test assertions. - [x] Fix modeling of `#[repr]`. - [ ] ~~Add tests of `#[doc(hidden)]` in `Item::attrs` (probably in a seperate PR).~~ I'm gonna punt this to a future PR - [x] Documentation.
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143891 (Port `#[coverage]` to the new attribute system) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
…istime, r=GuillaumeGomez rustdoc-json: Structured attributes Implements and closes rust-lang#141358. This has 2 primary benefits. 1. For rustdoc-json consumers, they no longer need to parse strings of attributes, but it's there in a structured and normalized way. CC ``@obi1kenobi`` 2. For rustc conributors, the output of HIR pretty printing is no longer a versioned thing in the output. People can work on rust-lang#131229 without needing to bump `FORMAT_VERSION`. CC ``@jdonszelmann`` ``@JonathanBrouwer.`` (Over time, as the attribute refractor continues, I expect we'll add new things to `rustdoc_json_types::Attribute`. But this can be done separately to the rustc changes). Todo before being mergable: - [x] Update test assertions. - [x] Fix modeling of `#[repr]`. - [ ] ~~Add tests of `#[doc(hidden)]` in `Item::attrs` (probably in a seperate PR).~~ I'm gonna punt this to a future PR - [x] Documentation.
…bzol tidy: check for invalid file names Check for file names added to git with: - non-UTF8 filenames (this would fail "fmt check" with a decoding error for the moment, but maybe we should not count on it as it is an accidental failure) - control characters (such as "\n" or "\r" in file names) - ":" (which is a special character on Windows, made rust-lang#142936 fail in bors while it could have be caught earlier) It only checks files known by git as a developer might want to have "strange" file names alongside their local repository as long as they don't check them in. r? jieyouxu as he stumbled upon such a file in rust-lang#142936
Rollup of 13 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143719 (Emit warning when there is no space between `-o` and arg) - #143738 (Move several float tests to floats/mod.rs) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143957 (tidy: check for invalid file names) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) - #143990 (Add LocalKey<Cell>::update) r? `@ghost` `@rustbot` modify labels: rollup
…bzol tidy: check for invalid file names Check for file names added to git with: - non-UTF8 filenames (this would fail "fmt check" with a decoding error for the moment, but maybe we should not count on it as it is an accidental failure) - control characters (such as "\n" or "\r" in file names) - ":" (which is a special character on Windows, made rust-lang#142936 fail in bors while it could have be caught earlier) It only checks files known by git as a developer might want to have "strange" file names alongside their local repository as long as they don't check them in. r? jieyouxu as he stumbled upon such a file in rust-lang#142936
Rollup of 12 pull requests Successful merges: - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - #143738 (Move several float tests to floats/mod.rs) - #143920 (Make more of codegen_llvm safe) - #143921 (Constify `Index` traits) - #143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - #143948 (Update mdbook to 0.4.52) - #143957 (tidy: check for invalid file names) - #143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) - #143990 (Add LocalKey<Cell>::update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143957 - samueltardieu:tidy-filenames, r=Kobzol tidy: check for invalid file names Check for file names added to git with: - non-UTF8 filenames (this would fail "fmt check" with a decoding error for the moment, but maybe we should not count on it as it is an accidental failure) - control characters (such as "\n" or "\r" in file names) - ":" (which is a special character on Windows, made #142936 fail in bors while it could have be caught earlier) It only checks files known by git as a developer might want to have "strange" file names alongside their local repository as long as they don't check them in. r? jieyouxu as he stumbled upon such a file in #142936
Rollup merge of #142936 - aDotInTheVoid:rdj-shatts-forrealthistime, r=GuillaumeGomez rustdoc-json: Structured attributes Implements and closes #141358. This has 2 primary benefits. 1. For rustdoc-json consumers, they no longer need to parse strings of attributes, but it's there in a structured and normalized way. CC ```@obi1kenobi``` 2. For rustc conributors, the output of HIR pretty printing is no longer a versioned thing in the output. People can work on #131229 without needing to bump `FORMAT_VERSION`. CC ```@jdonszelmann``` ```@JonathanBrouwer.``` (Over time, as the attribute refractor continues, I expect we'll add new things to `rustdoc_json_types::Attribute`. But this can be done separately to the rustc changes). Todo before being mergable: - [x] Update test assertions. - [x] Fix modeling of `#[repr]`. - [ ] ~~Add tests of `#[doc(hidden)]` in `Item::attrs` (probably in a seperate PR).~~ I'm gonna punt this to a future PR - [x] Documentation.
tidy: check for invalid file names Check for file names added to git with: - non-UTF8 filenames (this would fail "fmt check" with a decoding error for the moment, but maybe we should not count on it as it is an accidental failure) - control characters (such as "\n" or "\r" in file names) - ":" (which is a special character on Windows, made rust-lang/rust#142936 fail in bors while it could have be caught earlier) It only checks files known by git as a developer might want to have "strange" file names alongside their local repository as long as they don't check them in. r? jieyouxu as he stumbled upon such a file in rust-lang/rust#142936
Rollup of 12 pull requests Successful merges: - rust-lang/rust#142936 (rustdoc-json: Structured attributes) - rust-lang/rust#143355 (wrapping shift: remove first bitmask and table) - rust-lang/rust#143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - rust-lang/rust#143692 (miri: fix out-of-bounds error for ptrs with negative offsets) - rust-lang/rust#143738 (Move several float tests to floats/mod.rs) - rust-lang/rust#143920 (Make more of codegen_llvm safe) - rust-lang/rust#143921 (Constify `Index` traits) - rust-lang/rust#143939 (Add 0323pin as maintainer of NetBSD targets, fix link to pkgsrc-wip and explain.) - rust-lang/rust#143948 (Update mdbook to 0.4.52) - rust-lang/rust#143957 (tidy: check for invalid file names) - rust-lang/rust#143968 (Add tracing to `InterpCx::fn_abi_of_instance/fn_abi_of_fn_ptr`) - rust-lang/rust#143990 (Add LocalKey<Cell>::update) r? `@ghost` `@rustbot` modify labels: rollup
Implements and closes #141358.
This has 2 primary benefits.
FORMAT_VERSION
. CC @jdonszelmann @JonathanBrouwer.(Over time, as the attribute refractor continues, I expect we'll add new things to
rustdoc_json_types::Attribute
. But this can be done separately to the rustc changes).Todo before being mergable:
#[repr]
.Add tests ofI'm gonna punt this to a future PR#[doc(hidden)]
inItem::attrs
(probably in a seperate PR).